<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:67:"/var/www/html/CRM/public/../application/admin/view/admin/admin.html";i:1541157310;}*/ ?>
﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理员管理</title>
<link rel="stylesheet" type="text/css" href="/admin/css/css.css" />
<script type="text/javascript" src="/admin/js/jquery.min.js"></script>
<!-- <script type="text/javascript" src="js/page.js" ></script> -->
</head>
<style>
	td{
		padding: 10px 0;
	}
	.buttone{
		display: inline-block;
		padding: 1% 1.5%;
		color: white;
		background: #47a4e1;
		border: none;
		border-radius: 4px;
	}
	.paging{
		height:8%;
	}
	.cfD{
		display: inline-block;
	}
	.pagination>li{
		float: left;
		text-align: center;
		border-radius: 5px;
	}
	.pagination>li:hover{
		background-color: #47a4e1;
	}
	.pagination>li:hover>span{
		color: white;
	}
	.pagination>li>a{
		display: inline-block;
		width: 66px;
		line-height: 2rem;
		border-radius: 5px;
		border: 1px solid #CCCCCC;
	}
	.pagination>li>span{
		display: inline-block;
		width: 66px;
		line-height: 2rem;
		color: #47a4e1;
		font-weight: bold;
		font-size: 18px;
	}
	.pagination>li.disabled{
		border-radius: 5px;
		border: 1px solid #CCCCCC;
	}
	.pagination{
		width:auto;
		height: 100%;
		margin: 0 auto;
		float:right;
	}
</style>
<body>
	<div id="pageAll">
		<div class="pageTop">
			<div class="page">
				<img src="/admin/img/coin02.png" /><span><a href="<?php echo url('admin/index/main'); ?>" target="main">首页</a>&nbsp;-&nbsp;</span>
				管理员管理
			</div>
		</div>

		<div class="page">
			<!-- balance页面样式 -->
			<div class="connoisseur">
				<div class="conform">
					<form style="margin-top: 15px">
						<a class="cfD">
							<input class="addUser"  id="selectname" type="text" placeholder="" />
						</a>
						<a class="cfD" href="<?php echo url('admin/admin/namep'); ?>" id="selectbyname">
							<button class="button" style="position: relative; z-index: -1">搜索</button>
						</a>
						<a href="<?php echo url('admin/admin/insert'); ?>" class="cfD">
							<button class="button" style="position: relative; z-index: -1">添加管理员</button>
						</a>
					</form>
				</div>
				<!-- bbalance 表格 显示 -->
				<div class="conShow">
					<table border="1" cellspacing="0" cellpadding="0">
						<tr>
							<td width="66px" class="tdColor tdC">序号</td>
							<td width="255px" class="tdColor">管理员姓名</td>
							<td width="210px" class="tdColor">角色</td>
							<td width="280px" class="tdColor">时间</td>
							<td width="380px" class="tdColor">状态</td>
							<td width="380px" class="tdColor">操作</td>
						</tr>
						<?php if(is_array($result) || $result instanceof \think\Collection || $result instanceof \think\Paginator): $i = 0; $__LIST__ = $result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>

						<tr>
							<td><?php echo $key+1; ?></td>
							<td>
								<?php echo $vo['user_name']; ?>
							</td>
							<td>
								<?php switch($vo['user_r_id']): case "1": ?>超级管理<?php break; case "2": ?>推广部主管<?php break; case "3": ?>电话部主管<?php break; case "4": ?>话务员<?php break; case "5": ?>前台<?php break; case "6": ?>咨询部主管<?php break; case "7": ?>咨询人员<?php break; case "8": ?>预科主管<?php break; case "9": ?>教务部<?php break; case "10": ?>项目开发部主管<?php break; case "11": ?>开发人员<?php break; case "12": ?>项目设计部主管<?php break; case "13": ?>设计人员<?php break; case "14": ?>就业部主管<?php break; case "15": ?>就业部员工<?php break; default: ?>default
								<?php endswitch; ?>
							</td>
							<td>
								<?php if(!empty($vo['user_createtime'])): ?>
									<?php echo date("Y-m-d H:i:s",$vo['user_createtime']); else: endif; ?>
							</td>
							<td class="pppppp">
								<?php if($vo['user_dell'] == 0): ?>
									不可用
								<?php else: ?>
									可用
								<?php endif; ?>
							</td>
							<td>
								<?php if($vo['user_name'] == $_SESSION['u_name']): ?>
									<button class="buttone" disabled style="background-color: #CCCCCC">删除</button>
								<?php else: if($vo['user_dell'] == 0): ?>
										<button class="buttone" onclick="change(this,'<?php echo $vo['user_id']; ?>','<?php echo $vo['user_dell']; ?>')">恢复</button>
									<?php else: ?>
										<button class="buttone" onclick="change(this,'<?php echo $vo['user_id']; ?>','<?php echo $vo['user_dell']; ?>')" >删除</button>
									<?php endif; endif; if($vo['user_name'] == $_SESSION['u_name']): ?>
									<a href="javascript:;" ><button class="buttone" style="position:relative; z-index: -1;background-color: #CCCCCC" disabled>修改</button></a>
									<a href="javascript:;"><button class="buttone" style="position:relative; z-index: -1;background-color: #CCCCCC" disabled>重置密码</button></a>
								<?php else: ?>
									<a href="<?php echo url('admin/admin/update',['id'=>$vo['user_id']]); ?>"><button class="buttone" style="position:relative; z-index: -1">修改</button></a>
									<a href="" onclick="resetpass(this)"><button class="buttone" style="position:relative; z-index: -1">重置密码</button></a>
								<?php endif; ?>
							</td>
						</tr>
						<?php endforeach; endif; else: echo "" ;endif; ?>
					</table>
					<div class="paging">
						<?php echo $result->render(); ?>
					</div>
				</div>
				<!-- balance 表格 显示 end-->
			</div>
			<!-- balance页面样式end -->
		</div>

	</div>

</body>

	<script>
		function resetpass(a){
			if(confirm("确定重置密码？重置后密码为:z123456")){
				$(a).attr("href","<?php echo url('admin/admin/reset',['id'=>$vo['user_id']]); ?>")
			}
		}
		$("#selectname").change(function(){
			var name=$(this).val();
			$("#selectbyname").attr("href","/admin/admin/namep?name="+name);
		});

		function change(a,b){
			var d=$(a).text();
			if(d=="恢复"){
				$(a).text("删除");
				d=1;
			}else{
				$(a).text("恢复");
				d=0;
			}
			if($(a).parent().parent().children("td.pppppp").html()=="可用"){
				$(a).parent().parent().children("td.pppppp").html("不可用");
			}
			else{
				$(a).parent().parent().children("td.pppppp").html("可用");
			}
			$.post("<?php echo url('admin/admin/delete'); ?>",{"id":b,"dell":d},function(c){
				if(c){
					alert("删除/恢复成功!");
				}
			},'json')
		}
	</script>
</html>